home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
dirut
/
bm_rm.zip
/
RM.DOC
< prev
next >
Wrap
Text File
|
1991-11-12
|
8KB
|
150 lines
RM - Remove files and/or directory subtrees
Copyright (C) 1989, 1990, 1991 Brian B. McGuinness
15 Kevin Road
Scotch Plains, NJ 07076
This function is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 1, or (at your option) any later version.
This function is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along with
this function; if not, write to the Free Software Foundation, Inc., 675 Mass
Ave, Cambridge, MA 02139, USA.
--------------------------------------------------------------------------------
WARNING: Careless use of this utility can lead to the loss of important data,
directories, and/or program files. Read the instructions carefully before
using RM. If files are accidentally deleted on a particular drive, use an
unerase utility to recover the deleted files. Directories may sometimes be
recovered in a similar way. Do NOT create or edit any other directories or
files on that drive before recovery of the accidentally deleted material has
been completed. Unerase and directory unremoval utilities may be found as
public domain or shareware programs on various bulletin board systems. They
may also be found in commercial software packages such as The Norton Utilities
(TM), The Mace Utilities (TM), or PC-Tools (TM).
--------------------------------------------------------------------------------
Syntax: RM [/AEFIRSV?] {name | @}...
/A = Remove all matching files, even hidden and system files (these are not
normally detected and removed). If RM is used to remove files in the
root directory of a bootable disk, especially a hard disk, /A should not
be used with /F as there is a risk of removing the system files
IBMBIO.COM (IO.SYS) and IBMDOS.COM (MSDOS.SYS). This would make it
impossible to boot the system from that disk.
/E = Only delete matching files whose file size is zero. Normally, we delete
matching files regardless of their size. This option is useful for
disposing of empty "junk" files produced by programs or by failed
attempts at I/O redirection. For example, to remove ALL empty files from
drive C:, use the command RM /ES C:\*.* (/S is explained below). Note
that empty files use up no disk space but they do use up a directory entry.
/F = Force deletion of files without asking. Normally, we prompt the user for
confirmation before removing read-only, hidden, or system files or before
assuming "\*.*" at the end of a directory name (see /R below). If the /F
switch is used, these files are removed without any prompt being given.
Do NOT use this switch unless you are absolutely sure that you know what
you are doing.
/I = Interactive mode: the user is prompted for confirmation before each file
is removed, regardless of the file's attributes. This prompt will look
something like:
Delete C:\COMM\TEMP\RM.DOC 7685 16 Jul 1991 22:43 A----- [N]?
The word "Delete" is followed by the full pathname of the file in
question. Next, the file size and the date and time of last modification
are given. Then the file's attributes are displayed: A = Archive (the
file was modified since the last time it was backed up with the DOS
BACKUP command), D = Directory and V = Volume label (these two never show
up in the prompt), S = System file (part of DOS; if you remove these
files you won't be able to boot from that disk), H = Hidden (the file is
not displayed by the DOS DIR command), and R = Read-Only (can't be
deleted by the DOS DEL command). Dashes indicate attributes which aren't
set. The "[N]" means that the default response is "NO," so if you press
any key other than "Y" or "y" (for "yes") the file will not be deleted.
If you press the Esc key, RM will exit to DOS.
/R = Recursively delete entire subtrees. Normally, when a directory name
appears on the command line it is treated as if "\*.*" was appended to
it. If the /R switch is used, RM will descend through any directory
whose name is found on the command line and will remove that directory
and all files and subdirectories contained within that directory.
Removing the current default directory or any directory which contains
the current default directory is not allowed.
If /I is also in effect, you will be prompted for confirmation before
each directory is examined. If you do not respond with 'Y' or 'y', that
directory will be skipped.
/S = Delete matching files in an entire subtree. For example, entering
RM \UTIL\*.BAK will delete all files in the \UTIL directory which have
the extension .BAK. Typing RM /S \UTIL\*.BAK will delete all .BAK
files in the \UTIL directory and all subdirectories of \UTIL. Typing
RM /S *.DOC will remove all .DOC files in the current default directory
and all of its subdirectories. /S ignores directory names: e.g., if you
have a directory called \ASM, then typing RM /S \ASM will do nothing. To
remove all files in \ASM and its subdirectories, type RM /S \ASM\*.*.
/S will only remove files, not directories. Use /R to remove a whole
subtree.
/V = Verbose: display the full pathname of each file or directory as it is
removed. Directory names are enclosed in brackets for ease of
identification.
/? = Display instructions for using this program
Note: Switches become active as they are encountered on the command line. If
a switch is to affect a given file, it must appear before the file's
name on the command line. Moreover, switches may be combined (e.g. /AI
is the same as /A /I).
name = The name of a file or directory to be removed. Wildcards may be used.
@ = Read a list of names and/or switches from the standard input device and
treat each of these as if it had been typed on the command line as an
argument of RM. More than one name and/or switch may appear on each
line of input. When an EOF is encountered, processing of the command
line resumes.
This feature is useful when used with a file containing a lengthy list
of names of files to be deleted. It may also be used with any program
which writes a list of file names to standard output: for example, a
program which lists all files in a given directory which have not been
modified since a certain date.
If the environment string VERBOSE exists and has the value ON, then RM will
act as though the /V switch is in effect even if /V is not included on the
command line. If you wish RM to always execute in verbose mode, you may find
it convenient to include the MS-DOS command SET VERBOSE=ON in your
AUTOEXEC.BAT file.
Examples:
The following command will remove all backup (.BAK) files on drive C:
RM /S C:\*.BAK
The following command will remove the directory A:\PASCAL and all files and
directories contained within A:\PASCAL, prompting the user for confirmation
before deleting each file:
RM /RI A:\PASCAL
This command will delete all files in the current directory whose names have
the extension .C or .H or .OBJ:
RM *.C *.H *.OBJ
This command deletes all files whose names are given in the text file DELNAMES:
RM @ <DELNAMES